home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-0039
/
source
/
dcscreen.mod
< prev
next >
Wrap
Text File
|
1997-04-16
|
13KB
|
362 lines
IMPLEMENTATION MODULE DCScreen;
(*---------------------------------------------------------------------*)
(* Screen Display Module for DegasConvert *)
(* *)
(* Functions: *)
(* Show a screen display on the screen taking account of *)
(* the current screen resolution. *)
(* Display High or Medium resolution Picture on the screen. *)
(* Convert a hi-res display to a med-res display *)
(* *)
(* V.2: Add routine to display a picture on the full screen. *)
(* *)
(* Version 2.0 August 1988 L.G.Miller *)
(* *)
(* Version 1.1 August 1987 L.G.Miller *)
(*---------------------------------------------------------------------*)
(*---------------------------------------------------------------------*)
(* Import List *)
(*---------------------------------------------------------------------*)
(* IMPORT Trace; *)
FROM DCGlobal IMPORT LowRes, MedRes, HiRes,
HiResScreen, MedResScreen,
HiResScreenLine, MedResScreenLine,
HiResMaxX, HiResMaxY, HiResNoPlanes,
MedResMaxX, MedResMaxY, MedResNoPlanes,
BitPlanesEnum, BITSPERWORD,
HiRes16PixelsPtr,
MedRes16PixelsPtr,
TheWindow;
FROM DCPicCnv IMPORT MedRes16PixelsAddr,
HiRes16PixelsAddr;
FROM DCQScrn IMPORT HiToMedRes;
FROM SYSTEM IMPORT ADDRESS, ADR;
IMPORT Window;
FROM VDI IMPORT MFDB,
vro_cpyfm,
vrt_cpyfm,
vr_trnfm;
(* INCLUDE FOR ManyWindows ; *)
FROM ManyWindows IMPORT
XYWHRect,
CornersRect,
WindowStates, (* = ( open, full, topped ); *)
WindowSSet, (* = SET OF WindowStates; *)
WindowPtr, (* = POINTER TO AWindow; *)
AWindow, (* = RECORD
Handle : INTEGER; (* The AES window handle *)
State : WindowSSet;
Outer,
Workarea,
PrevSize : WindowCoordinate;
Components : ComponentSet;
Font : FontData;
Title : String;
END; (* Window *)
VAR *)
AESApplId,
VDIHandle,
ScreenResolution,
ShowAlert,
StartApplication,
CreateAWindow,
SetAWindowTitle,
OpenAWindow,
ClearAWindow,
CloseAWindow,
DeleteAWindow,
TerminateApplication,
SetUpdateRect,
GetNextRect,
(* various conversion / translation utilities *)
ToXYWHRect,
ToCornersRect,
QueryIntersect,
GetWindowHandle,
GetWindowPtr,
BeginScreenUpdate,
EndScreenUpdate,
ShowMouse,
HideMouse;
(* END ManyWindows. *)
(*---------------------------------------------------------------------*)
(* End Of Import List *)
(*---------------------------------------------------------------------*)
TYPE
BigPxyArrayType = ARRAY [ 0 .. 128 ] OF INTEGER;
SmallArrayType = ARRAY [ 0 .. 32 ] OF INTEGER;
BitsetPtr = POINTER TO BITSET;
(* --------------------------------------------------------------------- *)
(* Given a rectangle from GEM, draw the HiResPicture on the HiRes Scrn *)
(* Draw intersection rectangle using VDI raster operations. *)
(* --------------------------------------------------------------------- *)
PROCEDURE DrawPartialHiResScreen( VAR picture : HiResScreen;
PartRect : XYWHRect ); (* partial rect *)
CONST WrModeIsReplace = 3;
VAR OutPicMFDB, ScrnMFDB : MFDB; (* rebuild these each time for now *)
XYWHPtr : POINTER TO CornersRect;
CRect : CornersRect;
OutPicPxyArray : BigPxyArrayType;
(* Use TheWindow size *)
BEGIN
ScrnMFDB.Block := ADDRESS(LONGCARD(0)); (* this is the screen *)
WITH OutPicMFDB DO
Block := ADR(picture);
Width := HiResMaxX+1;
Height := HiResMaxY+1;
WordWidth := (HiResMaxX+1) DIV BITSPERWORD;
DeviceDependant := BOOLEAN(0);
Planes := 1;
END; (* with *)
XYWHPtr := ADR(OutPicPxyArray[0]);
ToCornersRect(PartRect, XYWHPtr^);
XYWHPtr := ADR(OutPicPxyArray[4]);
ToCornersRect(PartRect, XYWHPtr^);
vro_cpyfm(VDIHandle,
WrModeIsReplace,
OutPicPxyArray,
OutPicMFDB,
ScrnMFDB );
END DrawPartialHiResScreen;
(* --------------------------------------------------------------------- *)
(* Given a rectangle from GEM, draw the MedResPicture on the Medium *)
(* resolution screen. *)
(* --------------------------------------------------------------------- *)
PROCEDURE DrawPartialMedResScreen( VAR picture : MedResScreen;
PartRect : XYWHRect);(* partial rect *)
CONST WrModeIsReplace = 3;
VAR XYWHPtr : POINTER TO CornersRect;
CRect : CornersRect;
OutPicMFDB, ScrnMFDB : MFDB; (* rebuild these each time for now *)
(* global?? *)
OutPicPxyArray : BigPxyArrayType;
ColourArray : SmallArrayType;
(* Use TheWindow size *)
BEGIN
ScrnMFDB.Block := ADDRESS(LONGCARD(0)); (* this is the screen *)
WITH OutPicMFDB DO
Block := ADR(picture);
Width := MedResMaxX+1;
Height := MedResMaxY+1;
WordWidth := (MedResMaxX+1) DIV BITSPERWORD;
DeviceDependant := BOOLEAN(0);
Planes := 2;
END; (* with *)
XYWHPtr := ADR(OutPicPxyArray[0]);
ToCornersRect(PartRect, XYWHPtr^);
XYWHPtr := ADR(OutPicPxyArray[4]);
ToCornersRect(PartRect, XYWHPtr^);
ColourArray[0]:=0;
ColourArray[1]:=1;
vro_cpyfm(VDIHandle,
WrModeIsReplace,
OutPicPxyArray,
OutPicMFDB,
ScrnMFDB)
END DrawPartialMedResScreen;
(*----------------------------------------------------------------------*)
(* For colour users rearrange a hi-res screen into a med-res screen *)
(* *)
(* Two hi-res screen lines make one med-res line. *)
(*----------------------------------------------------------------------*)
PROCEDURE ConvertHiToMedResDisplay ( VAR hiresdisplay : HiResScreen;
VAR medresdisplay : MedResScreen );
BEGIN
HiToMedRes( hiresdisplay, medresdisplay );
END ConvertHiToMedResDisplay;
PROCEDURE DisplayFullMedResPicture( VAR picture : MedResScreen );
CONST WrModeIsReplace = 3;
VAR XYWHPtr : POINTER TO CornersRect;
FullRect : XYWHRect; (* display rect co-ords *)
OutPicMFDB, ScrnMFDB : MFDB; (* rebuild these each time for now *)
OutPicPxyArray : BigPxyArrayType;
ColourArray : SmallArrayType;
(* Use FULL SCREEN SIZE *)
BEGIN
ScrnMFDB.Block := ADDRESS(LONGCARD(0)); (* this is the screen *)
WITH OutPicMFDB DO
Block := ADR(picture);
Width := MedResMaxX+1;
Height := MedResMaxY+1;
WordWidth := (MedResMaxX+1) DIV BITSPERWORD;
DeviceDependant := BOOLEAN(0);
Planes := 2;
END; (* with *)
WITH FullRect DO
X := 0;
Y := 0;
Width := MedResMaxX+1;
Height := MedResMaxY+1;
END;
XYWHPtr := ADR(OutPicPxyArray[0]);
ToCornersRect(FullRect, XYWHPtr^);
XYWHPtr := ADR(OutPicPxyArray[4]);
ToCornersRect(FullRect, XYWHPtr^);
ColourArray[0]:=0;
ColourArray[1]:=1;
vro_cpyfm(VDIHandle,
WrModeIsReplace,
OutPicPxyArray,
OutPicMFDB,
ScrnMFDB)
END DisplayFullMedResPicture;
(* --------------------------------------------------------------------- *)
(* Draw the Full picture on the hi-res screen. *)
(* --------------------------------------------------------------------- *)
PROCEDURE DisplayFullHiResPicture( VAR picture : HiResScreen );
CONST WrModeIsReplace = 3;
VAR XYWHPtr : POINTER TO CornersRect;
FullRect : XYWHRect; (* display rect co-ords *)
OutPicMFDB, ScrnMFDB : MFDB; (* rebuild these each time for now *)
OutPicPxyArray : BigPxyArrayType;
(* Use TheWindow size *)
BEGIN
ScrnMFDB.Block := ADDRESS(LONGCARD(0)); (* this is the screen *)
WITH OutPicMFDB DO
Block := ADR(picture);
Width := HiResMaxX+1;
Height := HiResMaxY+1;
WordWidth := (HiResMaxX+1) DIV BITSPERWORD;
DeviceDependant := BOOLEAN(0);
Planes := 1;
END; (* with *)
WITH FullRect DO
X := 0;
Y := 0;
Width := HiResMaxX+1;
Height := HiResMaxY+1;
END;
XYWHPtr := ADR(OutPicPxyArray[0]);
ToCornersRect(FullRect, XYWHPtr^);
XYWHPtr := ADR(OutPicPxyArray[4]);
ToCornersRect(FullRect, XYWHPtr^);
vro_cpyfm(VDIHandle,
WrModeIsReplace,
OutPicPxyArray,
OutPicMFDB,
ScrnMFDB );
END DisplayFullHiResPicture;
(*----------------------------------------------------------------------*)
(* Show picture, convert to hi-res screen if required... *)
(*----------------------------------------------------------------------*)
VAR ms : MedResScreen; (* declare this as a GLOBAL variable *)
PROCEDURE DisplayPicture ( VAR hirespicture : HiResScreen );
BEGIN
IF ScreenResolution = HiRes THEN
DisplayHiResPicture( hirespicture );
ELSE
ConvertHiToMedResDisplay( hirespicture, ms );
DisplayMedResPicture( ms );
END;
END DisplayPicture;
(* ----------------------------------------------------------------- *)
(* DRAW SCREEN will only work in hi-res & med-res *)
(* ----------------------------------------------------------------- *)
(* --------------------------------------------------------------------- *)
(* Draw the screen ( Hi or Medium res ). The method used is the one *)
(* recommended for GEM of 'walking' the rectangle list. *)
(* --------------------------------------------------------------------- *)
PROCEDURE DisplayHiResPicture ( VAR picture : HiResScreen );
VAR UpdateWindow : BOOLEAN;
RedrawRect : XYWHRect;
BEGIN
HideMouse;
SetUpdateRect( TheWindow, TheWindow^.Workarea );
UpdateWindow := GetNextRect(TheWindow, RedrawRect);
WHILE UpdateWindow DO
DrawPartialHiResScreen(picture, RedrawRect);
UpdateWindow := GetNextRect(TheWindow, RedrawRect);
END; (* while *)
ShowMouse;
END DisplayHiResPicture;
PROCEDURE DisplayMedResPicture ( VAR picture : MedResScreen );
VAR UpdateWindow : BOOLEAN;
RedrawRect : XYWHRect;
BEGIN
HideMouse;
SetUpdateRect( TheWindow, TheWindow^.Workarea );
UpdateWindow := GetNextRect(TheWindow, RedrawRect);
WHILE UpdateWindow DO
DrawPartialMedResScreen(picture, RedrawRect);
UpdateWindow := GetNextRect(TheWindow, RedrawRect);
END; (* while *)
ShowMouse;
END DisplayMedResPicture;
(*----------------------------------------------------------------------*)
(* Show FULL picture, convert to hi-res screen if required... *)
(*----------------------------------------------------------------------*)
PROCEDURE DisplayFullPicture ( VAR hirespicture : HiResScreen );
BEGIN
IF ScreenResolution = HiRes THEN
DisplayFullHiResPicture( hirespicture );
ELSE
ConvertHiToMedResDisplay( hirespicture, ms );
DisplayFullMedResPicture( ms );
END;
END DisplayFullPicture;
END DCScreen.